var Import = function (){

    var _APIData = {};

    _APIData.uploadUrl = 'imp';

    var _initTable =function (){
        jQuery("#excelImportTable").bootstrapTable({
            url:_APIData.excelImport,
            toolbar:jQuery(".data-title-tooltip"),//工具栏
            method:"post",
            sidePagination: "client",//客户端分页
            striped: true, //间隔色
            pagination:true,//是否显示分页
            clickToSelect:true,
            toolbar:jQuery("#toolbar"),
            columns:[
                {
                    field: "indexNumber",
                    title:"序号",
                    align:"center",
                    halign: "center",
                    formatter:function (value,row,index){
                        return index + 1;
                    }
                },{
                    field:"userName",
                    title:"姓名",
                    sortable:true,
                    align: "center",
                    halign: "center"
                },{
                    field:"userName",
                    title:"性别",
                    sortable:true,
                    align: "center",
                    halign: "center"
                },{
                    field:"userName",
                    title:"电话",
                    sortable:true,
                    align: "center",
                    halign: "center"
                },{
                    field:"userName",
                    title:"邮箱",
                    sortable:true,
                    align: "center",
                    halign: "center"
                }
            ]
        })
    };

    var _initBindClick = function (){
        jQuery("#importExcelBt").unbind().bind("click",function (){
            jQuery(".modal").modal();
        });
    };

    var _initFileInput = function (){
        jQuery("#input").fileinput({
            language:'zh',
            theme:'fa',
            uploadAsync:false,
            uploadUrl: _APIData.uploadUrl,
            allowedFileExtensions: ['xlsx'],
            browseOnZoneClick: true,
            dropZoneEnabled:true,
            showUpload: false, //是否显示上传按钮
            showRemove:false, // 是否显示移除按钮
            showCaption: false,//是否显示标题
            showBrowse: false,//是否显示 browse 按钮
            showCancel:true,
            showPreview: true,
            maxFileCount: 1,
            minFileCount: 1,
            maxFileSize: 1024,
            minFileSize: 1
        }).on("filebatchselected",function (event,files){
            jQuery(this).fileinput("upload");
        });
    };

    return{
        init:function (){
            _initTable();
            _initBindClick();
        },
        initFileInput:function (){
            _initFileInput();
        }
    };
}();